package GameLoop;

import vooga.core.event.EventManager;
import vooga.core.event.IEventHandler;

public abstract class AbstractMenuTemplate extends AbstractScene {

	int numButtons;
	public AbstractMenuTemplate(EventManager em, int numButtons){
		super(em);
		this.numButtons=numButtons;
		for(int i=0;i<numButtons;i++){
			em.registerEventHandler("AbstractMenuTemplate.ButtonClick"+i, new IEventHandler()
	        {
	            @Override
	            public void handleEvent (Object o)
	            {
	                buttonClick(((Object[]) o));
	            	//use reflection to call the appropriate method name here. buttonClick+i
	            }
	
	        });
		}
	}
	
	protected void buttonClickTrigger(int butNum){
	      em.fireEvent((Object) new Object[]{this,butNum}, "AbstractMenuTemplate.ButtonClick"+butNum);
	}
		
	protected void buttonClick(Object[] o){
		AbstractMenuTemplate temp = ((AbstractMenuTemplate) o[0]);		
		//use reflection on temp and o[1] to call the appropriate method.
		String methName = "buttonHandler"+(Integer) o[1];
		
	}
}
